Timer rings having different time unit granularities

ABSTRACT

In a processing system, a method includes selecting, at a timer management component of a processor, a timer ring of a set of timer rings for a requested timer based on a time unit granularity associated with the requested timer, wherein each timer ring of the set has a different time unit granularity. The method further includes instantiating the requested timer in a selected entry of the selected timer ring. Instantiating the requested timer may include fixedly maintaining a record for the requested timer in the selected entry of the selected timer ring for the entire time span of the requested timer.

CROSS-REFERENCE TO RELATED APPLICATIONS

The present application is related to co-pending U.S. patent applicationSer. No. _____ (Attorney Docket No. DN31343EH), entitled “Coherent TimerManagement in a Multicore or Multithreaded System” and filed on evendate herewith, the entirety of which is incorporated by referenceherein.

BACKGROUND

Field of the Disclosure

The present disclosure relates generally to processing systems and, moreparticularly, to timer management in processing systems.

Description of the Related Art

Processing systems implementing parallel processing increasingly rely onnumerous timers to track various tasks. Most timer management systemstreat timers not as physical counters, but rather as data elementsallocated and instantiated in linked lists tied to a timer ring. Inconventional timer rings, a different set of entries, or “buckets,” ismaintained for each time unit (e.g., hours, minutes, seconds,milliseconds, etc.). When a timer is instantiated, the timer initiallyis placed in an initial entry of the set associated with the largesttime unit of its initial time span. For each tick in this largest timeunit, the timer is moved to the next entry representing the remainingtime for the timer, and when the remaining time for the timer changes toa smaller time unit, the timer is moved to the corresponding entry inthe set of entries associated with this smaller time unit, and so forth.

To illustrate, assume a timer ring includes a set of entries for thehour time unit (“hour set”), a set of entries for the minute time unit(“minute set”), and a set of entries for the second time unit (“secondset”). A timer having an initial time span of, for example, 2 hours,would be placed in an entry of the hour set that represents a two hourspan from the current entry in the hour set. When the remaining time onthe timer switches from 1 hour to 59 minutes, the timer is moved fromits entry in the hour set to an entry in the minute set representing a59 minute span from the current entry in the minute set. When theremaining time on the timer switches from 1 minute to 59 seconds, thetimer is then moved again to an entry of the second set that representsa span of 59 seconds from the current entry in the second set, and soforth. Thus, depending on its initial time span, a timer is movedbetween numerous timer rings before the timer expires. Moreover,depending on the number of timers currently pending and theirdistribution throughout the timer ring, each tick of the clockassociated with a time unit may result in the reassignment of numeroustimers in the entry associated with that clock tick. This frequent massmovement of timers among the entries of the conventional timer ringconsumes considerable resource bandwidth, and thus limits the number oftimers that may be effectively maintained in a processing system.

BRIEF DESCRIPTION OF THE DRAWINGS

The present disclosure may be better understood, and its numerousfeatures and advantages made apparent to those skilled in the art byreferencing the accompanying drawings. The use of the same referencesymbols in different drawings indicates similar or identical items.

FIG. 1 is a block diagram illustrating a processing system havingcoherent timer management in accordance with at least one embodiment ofthe present invention.

FIG. 2 is a block diagram illustrating a time management component ofthe processing system of FIG. 1 in accordance with at least oneembodiment of the present invention.

FIG. 3 is a flow diagram illustrating a method for allocating timeridentifiers (IDs) in a processing system in accordance with at least oneembodiment of the present invention.

FIG. 4 is a flow diagram illustrating a method for managing timer IDsafter timer expiration in a processing system in accordance with atleast one embodiment of the present invention.

FIG. 5 is a diagram illustrating an example timer management scenario ina processing system based on the methods of FIGS. 3 and 4 in accordancewith at least one embodiment of the present invention.

FIG. 6 is a diagram illustrating a granularity-based timer managementstructure of a processing system in accordance with at least oneembodiment of the present invention.

FIG. 7 is a flow diagram illustrating a method for instantiating a timerin the granularity-based timer management structure of FIG. 6 inaccordance with at least one embodiment of the present invention.

FIG. 8 is a diagram illustrating an example timer instantiation scenariobased on the method of FIG. 7 in accordance with at least one embodimentof the present invention.

FIG. 9 is a flow diagram illustrating a method for managing thegranularity-based timer management structure of FIG. 6 in accordancewith at least one embodiment of the present invention.

FIG. 10 is a diagram illustrating an example timer expiration scenariobased on the method of FIG. 9 in accordance with at least one embodimentof the present invention.

DETAILED DESCRIPTION

FIGS. 1-10 illustrate example techniques for large-scale coherent timermanagement in a processing system. In at least one embodiment, a timermanagement component manages timers instantiated in a timer managementstructure on behalf of executing threads, applications, hardwarecomponents of processor cores of the processing system, peripheralcomponents, and other requestor components in the processing system. Thetimer management component may provide efficient timer ID managementthrough the use of automated timer ID allocation and a hardware/softwarehandshake protocol that facilitates accurate and coherent reuse of timerIDs and prevents timer expirations from flooding processing system. Tothis end, the time management component maintains a defined set of timerIDs for use in identifying timers. In response to a request toinstantiate a timer, the time management component verifies whether atimer ID is not currently in use and thus available for allocation tothe requested timer. If a timer ID is available for allocation, thetimer management component instantiates the requested timer in the timermanagement structure and permits allocation of an available timer ID tothe instantiated timer.

A timer may comprise one of two types: a “one-shot” timer that expiresonce and then may released for use by another requestor component; and a“periodic” timer that may be reset to expire again for the samerequestor component. When a timer expires, a timer expirationnotification that includes the corresponding timer ID is broadcast orotherwise transmitted to the timer owners in the processing system. Inresponse to receiving and processing this expiration notification, thetimer owner that requested the timer that has expired sends a completionconfirmation message to the time management component so as to confirmthat the timer owner has taken notice of the expired timer. In the eventthat the corresponding timer is a “one-shot” timer, the timer managementcomponent holds the timer ID associated with the expired timer in a“non-allocatable” state until the completion confirmation message isreceived, at which point the timer management component releases thetimer ID from its “non-allocatable” state and thus making the timer IDavailable for reallocation to another timer. This handshake protocol forholding timer IDs until expiration has been confirmed avoids coherencyissues due to the transmission delay of expiration notifications. In theevent that the timer is a periodic timer, the release of the timer IDpermits the timer to be reset so that it may expire again after thecorresponding amount of time has lapsed. Moreover, in the case ofperiodic timers, the timer management component holds the timer IDassociated with the expired timer in a “non-resettable” state until thecompletion confirmation message is received, at which point the timermanagement component releases the timer ID from its “non-resettable”state and thus enabling the resetting of the corresponding timer. Thishandshake protocol thus prevents a flood of timer expirationnotifications due to periodic timers that have been unnecessarily resetand expired one or more times.

Further, in some embodiments, the timer management component maintains atimer management structure that utilizes different timer rings fordifferent time unit granularities. When a timer is instantiated, it isplaced in a corresponding entry of the timer ring associated with thegranularity of the timer, and is maintained in this same entry until itsexpiration. To illustrate, an implementation of this granularity-basedtimer management structure may maintain three timer rings: an hourgranularity timer ring that has a clock tick every hour; a minutegranularity timer ring that has a clock tick every minute; and a secondgranularity timer ring that has a clock tick every second. A timerinstantiation request requesting instantiation of a timer having a timespan of 2 hours and a granularity at the hour time unit level would beplaced in an entry of the hour granularity timer ring that is two hourclock ticks away from the current entry in the hour granularity timerring. In contrast, a timer request indicating a timer having a time spanof 120 minutes and a granularity at the minute time unit level would beplaced in an entry of the minute granularity timer ring that is 120minute clock ticks away from the current entry in the minute hourgranularity.

Under this approach, the instantiation of a timer is fixedly maintainedin the same linked list in the same entry of the same timer ring duringits entire time span. As such, frequent thrashing of the timermanagement structure due to timer movement among entries as found inconventional approaches may be avoided. Moreover, under this approach, atimer owner may specify the particular granularity needed for arequested timer, and thereby allow the timer management component tobetter suit the needs of timer owners in the processing system.

FIG. 1 illustrates a processing system 100 employing efficient andcoherent timer management in accordance with at least one embodiment ofthe present invention. The processing system 100 may be implemented inany of a variety of electronic devices or systems, such as a consumerelectronic device (e.g., a tablet computer, a notebook computer, acomputing-enabled cellphone, a computing-enabled wearable device, etc.),communications device (e.g., a router, a base station, a hub, etc.), acommercial or industrial device, (e.g., an automotive or aeronauticalcontrol system or an industrial-scientific-medical (ISM) controlsystem), and the like.

The processing system 100 includes a processor 102 and a memory 104. Theprocessor 102 comprises a timer management component 106 connected toone or more components of the processor 102, such as processor cores108, 110, 112, 114 (hereinafter, “processor cores 108-114”), via one ormore system interconnects 116. The processor cores 108-114 may compriseany of a variety of processing elements, such as a central processingunit (CPU) core, a graphics processing unit (GPU), a digital signalprocessor (DSP) core, and the like. The timer manager component 106, inone embodiment, is a hardware-based component of the processor 102 andis implemented using hardcoded logic or programmable logic. In otherembodiments, the timer manager component 106 may be implemented at leastin part as one or more processor cores executing software initiallystored in the memory 104 or other non-transitory computer readablemedium, and which manipulates the one or more processor cores toimplement certain features described herein.

The memory 104 comprises a volatile or non-volatile memory structureconfigured to store data and other information for the processor 102. Toillustrate, the memory 104 may comprise a random access memory (RAM),and more particularly, a double data rate (DDR) RAM. In the depictedexample, the memory 104 is implemented external to the processor 102(e.g., as system memory). However, in other embodiments, the memory 104may be implemented as memory within the processor 102; that is, as“on-chip” memory.

The processor 102 further may include various other components oftenimplemented in a processor and which are omitted from FIG. 1 forpurposes of clarity, such as input/output (I/O) controllers,co-processors or other accelerators, boot controllers, memorycontrollers, various interfaces, and the like. The operations of thesecomponents may be supplemented by various external components that maybe connected to the processor 102, such as one or more I/O components,mass storage devices, and the like.

Generally, the timer management component 106 is configured to providetimer management for timers instantiated for requesting components(hereinafter, “requestors”) within the processor 102. These requestorscan comprise software-based requestors, such as, for example, a thread118 executed by the processor core 108 or an application 120 executed bythe processor core 110, or hardware-based requestors, such as ahardcoded component 122 of the core 112 or a peripheral device 124connected to the processor 102. For ease of reference, a requestorhaving a timer instantiated in response to a request is referred toherein as a “timer owner.”

In at least one embodiment, the timer management component 106 isconfigured to manage timers through the use of a timer managementstructure 126 implemented as one or more data structures in acorresponding storage space of the memory 104. As described in greaterdetail herein, the timer management structure 126 comprises a set oftimer rings, such as timer rings 131, 132, 133, with each timer ringbeing associated with a different time unit granularity. For example,the timer ring 131 may have a granularity of microseconds, the timerring 132 may have a granularity of milliseconds, and the timer ring 133may have a granularity of seconds. As another example, the timer ring131 may have a granularity of seconds, the timer ring 132 may have agranularity of minutes, and the timer ring 133 may have a granularity ofhours.

In operation, the timer management component 106 provides an interfacefor receiving timer-related commands from requestors and for providingtimer-related notifications to requestors. To illustrate, forsoftware-based requestors, the processor 102 may provide an applicationprogramming interface (API) for requestors to issue timer commands andreceive timer notifications. The timer commands may include, for examplea timer instantiation request (that is, a request to create a newtimer), a request for early termination of a timer, a request to resetor recharge a timer, a timer release confirmation message to release atimer that has expired, and the like. The timer commands may includevarious parameters, such as a requested timer ID for a timer to beinstantiated, an initial time span for a timer to be instantiated,various conditional parameters for a timer to be instantiated, and thelike. The timer notifications provided by the timer management component106 can include, for example, a notification acknowledging instantiationof a timer, a notification that a request for a timer has failed, atimer expiration notification that a timer has expired, and the like.The timer notifications may be associated with a timer ID and may passvarious parameters or other information. Further, as described herein,timer notifications may spur subsequent responses from a receiving timerowner, such as a timer release confirmation message from a timer ownerin response to receiving and acknowledging a timer expirationnotification for an expired timer of the timer owner.

FIG. 2 illustrates an example implementation of the timer managementcomponent 106 in accordance with at least one embodiment. In thedepicted example, the timer management component 106 includes aninterface 202 to the system interconnect 116, an interface 204 to thememory 104, a master wall clock unit 206, a command parser 208, a timerID control (TIC) component 210, a timer processing unit (TPU) 212, and atimer expiration control (TEC) component 214. The command parser 208 iscoupled to the interface 202 and is configured to parse timer commandsand responses received from the requestors of the processing system 100via the system interconnect 116, as well as to format timernotifications from the TPU and TIC component 210 for broadcast or othertransmission to the requestors via the system interconnect 116.

The TIC component 210 is coupled to the command parser 208 and the TPU212 and is configured to manage the timer ID allocation process for thetimer management component 106. To this end, the TIC component 210 maymaintain a set of one or more tables, lists, or other data structures inthe memory 104 or other storage element of the processing system 100.These data structures can include, for example, a timer ID look up table(LUT) 216, with each entry of the timer ID LUT 216 associated with acorresponding timer ID and indicating whether the corresponding timer IDis currently in use, or active, and if so, providing information thatlinks the timer ID of an active timer to its timer owner so that thetimer management component 106 can translate between timer ID andrequestor ID. Alternatively, as described in greater detail below, thetimer management component 106 may facilitate the use of a thread ID, orother ID unique to the requestor, as the timer ID (or the basis of atimer ID) for a timer instantiated by the requestor. In such instances,a table linking each timer ID to its timer owner may not be needed asthe translation may be obtained directly from the timer ID. Instead, theTIC component 210 may implement a free timer ID list 218 that maintainsa list of timer IDs that are not currently active and thus available forallocation or, alternatively, timer IDs that are currently active andthus not available for activation.

The TPU 212 is coupled to the command parser 208, the TIC component 210,the TEC component 214, and the IF 204 and is configured to manage theprocessing of incoming timer commands from requestors, the processing ofoutgoing timer notifications to the requestors, as well as theinstantiation, deletion, modification and other requestor-initiatedqueries for timers within the timer management structure 126 via memoryaccess requests performed via the interface 204.

The master wall clock unit 206 is configured to provide the timingreferences used to manage the timers of the timer management structure126. To this end, the master wall clock unit 206 includes a master wallclock (MWC) for each timer ring of the timer management structure 126,with each MWC having a time unit granularity corresponding to the timeunit granularity of the associated timer ring. To illustrate, the masterwall clock unit 206 may include MWCs 231, 232, 233 for timer rings 131,132, 133, respectively. Each MWC signals clock ticks at a frequencycorrelated to the time unit granularity of its corresponding timer ring.To illustrate, if the timer ring 131 has an hour time unit granularity,the MWC 231 would issue a clock tick every hour, whereas if the timerring 133 has a microsecond granularity, then the MWC 233 would issue aclock tick every microsecond. The MWCs of the master wall clock unit 206may be implemented as independent clock sources (e.g., separate phaselocked loops (PLLs)), or they may be implemented from the same referenceclock source via separate frequency dividers, counter structures, orother mechanisms for providing clocks of different periods from the samebase clock.

The TEC component 214 is coupled to the master wall clock unit 206, theTPU 212, and the interface 204, and is configured to manage, inconjunction with the master wall clock unit 206, the process ofsequencing through the entries of timer rings of the timer managementstructure 126 responsive to the clock ticks of corresponding MWCs of themaster wall clock unit 206, as well as managing the process of expiringthe timers contained in the currently indexed entries of the timerrings.

FIGS. 3-5 together illustrate processes of instantiating timers,expiring timers, and managing the allocation, deallocation, andreallocation of timer IDs accordingly in the processing system 100. Forease of illustration, these processes are described in the examplecontext of the implementation of the timer management component 106 asdescribed above with reference to FIG. 2.

FIG. 3 depicts a method 300 for allocating timer IDs responsive to timercreation requests from requestors of the processing system 100 inaccordance with at least one embodiment of the present invention.Initial block 302 of method 300 represents the initialization processperformed by the processing system 100 upon entering a powered-on oractive state, such as after a power-on reset. As part of thisinitialization process, the master wall clocks of the master wall clockunit 206 are initialized, the TEC component 214 sets the pointers of thetimer rings of the timer management structure 126 to their initialpositions (e.g., entry 0), and the TIC component 210 initializes itstimer-related tables or lists so that all timer IDs are recognized asavailable for allocation at this point.

After initialization, at block 304 the command parser 208 monitors thesignaling on the system interconnect 116 for timer instantiationrequests from requestors. In response to receiving a timer instantiationrequest, at block 306 the TIC component 210 determines whether a timerID is available for allocation to the requested timer. In someembodiments, timer IDs are allocated to timers at will or independent ofan identifier or ID request of the requestor. In such instances, the TICcomponent 210 determines whether any timer IDs remain unallocated. TheTIC component 210 may identify available timer IDs via, for example, thefree timer ID list 218. In other embodiments, the requestor may specifya particular timer ID to be assigned to the requested timer, such as byspecifying the use of a thread ID or other ID unique to the requestor asthe timer ID. In such instances, the TIC component 210 may determinewhether the specified timer ID is available by, for example, performinga lookup into the timer ID LUT 216 using the specified timer ID.

In the event that a timer ID is unavailable for allocation or that thespecified timer ID is already in use, at block 308 the TIC component 210signals to the TPU 212 that timer ID allocation could not besuccessfully performed, and in response the TPU 212 sends a timerinstantiation failure notification to the requestor, either as abroadcast message that references the requestors timer creation requestin some manner, or as a unicast message directly to the requestor. Ifthe requestor remains intent on instantiating a timer, or instantiatinga timer with a specific timer ID, the requestor then may attempt thetimer instantiation again by submitting another timer instantiationrequest after a delay, which may be specified, quasi-random, or specificto the requestor.

However, rather than require a requestor to reattempt timerinstantiation at periodic intervals and thus potentially flood the timermanagement component 106 with speculative timer instantiation requests,in some embodiments the TIC component 210 implements a reservationfacility whereby a requestor may specify an intent to reserve aparticular timer ID for use when the timer ID next becomes available.The requestor may specify this intent via, for example, a parameter inthe original timer instantiation request, or the requestor may send aseparate reservation request in response to receiving the initial timerinstantiation failure notification. In response to indication that therequestor intends to reserve the timer ID, the TIC component 210 maymark the reserved status of the timer ID, such as by recording thethread ID of the requestor in a reservation field of the entry of thetimer ID LUT 216, or by maintaining a separate list or table of reservedtimer IDs. In some embodiments, the TIC component 210 may stringreservations such that a timer ID may be reserved by multiple requestorsin sequence of their requests, or in a sequence based on priority of therequest or priority of the requestor. In the event that this reservationfacility is implemented by the TIC component 210, at block 310 the TICcomponent 210 may reserve the requested timer ID for use by therequestor when the timer ID is deallocated from the current timer usingthe timer ID.

Returning to decision block 306, if the requested timer ID is available(if a specific timer ID is requested) or if at least one timer ID isavailable for allocation (if a specific timer ID has not beenrequested), at block 312 the TIC component 210 marks the timer IDselected for allocation to the requested timer as allocated, orcurrently in use. This may include updating the entry for the selectedtimer ID in the timer ID LUT 216 to reference the thread ID or other IDof the requestor in a timer owner field of the entry, removing the timerID from the free timer ID list 218, or adding the timer ID to anallocated timer ID list. Further, at block 314 the TIC component 210signals the allocated timer ID to the TPU 212 and, in response, the TPU212 instantiates the requested timer with the signaled timer ID in thetimer management structure 126. An example process for instantiating atimer in the timer management structure 126 is described in greaterdetail below with reference to FIGS. 6-8.

Assuming the timer is successfully instantiated in the timer managementstructure 126, at block 316 the TPU 212 signals successful timercreation to the requestor via an acknowledgement notification sent bythe command parser 208 via the system interconnect 116. Thisnotification may include, for example, a field containing an identifierof the requestor so that the requestor may identify the notification asbeing directed to it, as well as a field containing the allocated timerID.

FIG. 4 depicts a method 400 for managing timer IDs responsive to timerexpirations in the processing system 100 in accordance with at least oneembodiment of the present invention. The method 400 is described in theexample context of a particular one of the timer rings of the timermanagement structure 126, and this same method may be performed inparallel for the other timer rings within the timer management structure126.

As described in greater detail herein, each timer ring comprises a ringof entries, with each entry storing a linked list or other datastructure that identifies zero or more timers set to expire at a timeperiod associated with the entry. When the timer ring is initialized, aclock tick pointer is set to point to an initial entry (e.g., entry 0)of the timer ring, and with each clock tick of the MWC associated withthe timer, the clock tick pointer is shifted to the next entry in aspecified sequence in the ring of entries. The entry currently pointedto by the clock tick pointer is referred to herein as the “currententry.” Thus, for each clock tick of the MWC at block 402, the clocktick pointer shifts to the next entry and at block 404 the TEC component214 accesses the current entry to ascertain whether any timers arerepresented in the data structure stored in the current entry; that is,whether any timers are set to expire in the current clock tick of themaster clock. If not, the TEC component 214 waits for the next clocktick to repeat the process of block 404 again for the next entry of thetimer ring.

In the event there are one or more timers expiring in the current clocktick, at block 406 the TEC component 214 selects the first timer recordin the data structure stored in the current entry of the timer ring andsignals the expiration of this selected timer to the TPU 212. The TPU212 then broadcasts a timer expiration notification over the systeminterconnect 116 via the command parser 208 (or other dedicatedinterface for timer expiration notification purposes). In someembodiments, this timer expiration notification includes a reference tothe timer owner of the expired timer. To illustrate, the TIC component210 may perform a lookup into the timer ID LUT 216 using the timer ID ofthe expired timer to identify the thread ID of the timer owner for theexpired timer, and the timer expiration notification may include one orboth of the timer ID and the thread ID of the timer owner so that thetimer owner may identify the broadcast timer expiration notification asbeing directed to it.

There may be relatively long signal pathways, or multiple layers ofsignal pathways, in the one or more system interconnects 116 thatconnect the timer management component 106 to the timer owner, andadditional timer commands may be received during the considerable timethat the timer expiration notification may be in flight. Thus, if thetimer ID is associated with a one-shot timer and is released forreallocation immediately after timer expiration or immediately after thetimer expiration notification has been sent, it is possible that thetimer ID could be reallocated to another requestor before the previoustimer owner has been made aware of the timer expiration and consented torelease of the timer originally associated with the timer ID. If thetimer ID is associated with a periodic timer is reset again after timerexpiration without further confirmation from the timer owner, it ispossible that the timer owner did not need this iteration of theperiodic timer, and thus the subsequent timer expiration notificationsfrom such periodic timers could flood the signal pathways.

To avoid such coherency issues and expiration flood issues, in at leastone embodiment the TIC component 210 implements a handshake protocol toensure that the original timer owner has released the timer forreallocation (for one-shot timers) or for resetting (for periodictimers) in response to its expiration before the timer ID of the timermay be reallocated to another timer. To this end, at block 408 the TICcomponent 210 holds the timer ID as not available for allocation orresetting, or otherwise maintains the timer ID in anallocated/non-resettable state following the issuance of the timerexpiration notification at block 406 and then monitors for timer releaseconfirmation message from the timer owner at block 410. The timerrelease confirmation message acts as confirmation by the timer ownerthat the timer owner has received the timer expiration notification andhas released its claim on the timer (for one-shot timers) or hasreleased the timer so that it may be reset to expire again after aspecified period. Thus, in response to receiving the timer expirationnotification, if the timer owner is prepared to release the timer, thetimer owner sends a timer release confirmation message to the timermanagement component 106, with the timer ID referenced in the timerrelease confirmation message. However, if the timer owner is not yetprepared to release the timer for reallocation or recharging, the timerowner may refrain from issuing the timer release confirmation message,and instead issue other timer commands for the timer. Because the timerID has been held from being deallocated/recharged at block 408, thetimer ID and corresponding timer are still associated with the currenttimer owner and thus any new timer commands from the timer owner arelimited to modification of the timer instantiated by the timer owner,rather than modifying a new timer instantiated by another requestor.

In the event that a timer release confirmation message is received fromthe timer owner, at block 412 the TPU 212 signals the release of thetimer ID to the TIC component 210, which then releases the hold on thetimer ID. For a one-shot timer, this release may include, for example,adding the timer ID back to the free timer ID list 218 or by marking thetimer ID as unallocated in the timer ID LUT 216, so as to make the timerID available for reallocation to another timer requestor. Further, inembodiments whereby the TIC component 210 provides the reservationfacility, at block 414 the TIC component 210 may honor a reservationmade for the released timer ID at an iteration of block 310 of method300 of FIG. 3. In some embodiments, this may include the TIC component210 initiating the automatic instantiation of a timer with the reservedtimer ID on behalf of the reserving requestor in response to the timerID being deallocated at block 412. In other embodiments, the TICcomponent 210 may send an availability notification via the TPU 212 andcommand parser 208 to the reserving requestor, and the requestor mayrespond to this notification by either releasing the reservation througha reservation release command or by requesting instantiation of a timerwith the timer ID through a timer instantiation request. For a periodictimer, the release by the TPU 212 may include, for example, resetting orrecharging the timer so as to expire again after the corresponding timelapse.

As shown, after the TPU 212 has initiated transmission of the timerexpiration notification for the timer selected at block 404, the TECcomponent 214 may select the next timer in the data structure in thecurrent entry of the timer ring (if there is another timer yet to beprocessed) and the process of blocks 406, 408, 410, and 412 may berepeated for this next timer, and so forth, until all of the expiringtimers have been processed, at which point the method 400 returns toblock 402 to await the next clock tick.

FIG. 5 illustrates an example scenario using the methods 300, 400 in anexample simplified context whereby the TIC component 210 maintains twotimer IDs (ID 1 and ID 2) for the timer management component 106. Forpurposes of this scenario, both timer IDs are initially available forallocation. At time t0, a first requestor issues a timer instantiationrequest (“TMR_CREATE”) 501 to instantiate a timer. In response to thiscommand, the TIC component 210 verifies that timer ID 1 is available andthus the TPU 212 instantiates the requested timer with timer ID 1. Attime t1 a timer instantiation confirmation notification (“CREATE_ACK”)502 is sent to the first requestor. Similarly, at time t2 a secondrequestor issues a timer instantiation request 503 to instantiate atimer. In response to this command, the TIC component 210 verifies thattimer ID 2 is available and thus the TPU 212 instantiates the requestedtimer with timer ID 2. At time t3 a timer instantiation confirmationnotification 504 is sent to the second requestor. At time t4, a thirdrequestor issues a timer instantiation request 505 to instantiate atimer. However, as both timer IDs 1 and 2 are allocated at this point,no timer IDs are available for allocation and thus the TPU 212 signals atimer instantiation failure notification (“CREATE_FAIL”) 506 at time t5.For this example, it is assumed that a reservation facility isunavailable.

Subsequently, the timer having timer ID 1 expires at time t6, and inresponse the TEC component 214 initiates the broadcast of a timerexpiration notification 507 having timer ID 1 to all of the requestors.Because of the transmission delay, the timer expiration notification 507does not reach the first requestor until time t9, at which point thefirst requestor releases its claim on the timer ID 1 by issuing a timerrelease confirmation message 508. In the time period between theissuance of the timer expiration notification 507 and the receipt of thetimer release confirmation message 508, the third requestor againattempts to instantiate a timer by issuing a timer instantiation command509 at time t7. However, the timer ID 1 is maintained as unavailable forallocation at this point because the timer release confirmation message508 has not yet been received by the timer management component 106, andthus the TIC component 210 signals, through the TPU 212, a timerinstantiation failure notification 510 at time t8.

In response to receiving the timer release confirmation message 508 attime t10, the TIC component 210 releases the timer ID 1 so that it maybe deallocated from the timer for the first requestor. Accordingly, whenthe third requestor attempts to instantiate a timer for a third time byissuing a timer instantiation request 511 at time t11, timer ID 1 isavailable for allocation and thus the TPU 212 successfully instantiatesa timer for the third requestor and sends a timer instantiationconfirmation notification 512 with the timer ID 1 to the third requestorat time t12.

FIG. 6 illustrates an example implementation of the timer managementstructure 126 based on time unit granularities in conjunction with thecommand parser 208, the TPU 212, the TEC component 214, and the masterwall clock unit 206 in accordance with at least one embodiment of thepresent invention. In at least one embodiment, the timer managementstructure 126 comprises a plurality of timer rings, each timer ringcomprising a ring of entries and being associated with a different timeunit, or time unit granularity. To illustrate, in the depicted example,the timer management structure 126 includes four timer rings: a timerring 601 associated with an hour time unit granularity and having a ringof J entries 621; a timer ring 602 associated with a minute time unitgranularity and having a ring of K entries 622; a timer ring 603associated with a second time unit granularity and having a ring of Lentries 623; and a timer ring 604 associated with a millisecond timeunit granularity and having a ring of M entries 624, where J, K, L, andM are integers greater than 1 and which may be the same number ordifferent numbers. It should be noted that the number of timer rings andtheir respective time unit granularities in FIG. 6 are for illustrativepurposes only and are non-limiting. In other embodiments, more or fewertimer rings may be used, and different time unit granularities, ordifferent combinations thereof, may be used.

Each timer ring is associated with a different MWC of the master wallclock unit 206 that signals clock ticks at intervals corresponding tothe time unit granularity of the timer ring. To illustrate, a MWC 631provides clock ticks at 1 hour intervals for the timer ring 601, a MWC632 provides clock ticks at 1 minute intervals for the timer ring 602, aMWC 633 provides clock ticks at 1 second intervals for the timer ring603, and the MWC 634 provides clock ticks at 1 millisecond intervals forthe timer ring 604. The TEC component 214 maintains a “current tick”pointer for each timer ring. The counter tick pointer is initialized topoint to the initial entry (entry 0) of the corresponding timer ring,and with each clock tick of the corresponding MWC, the TEC component 214shifts the counter tick pointer to point to the next entry in the timerring. As the entries are logically arranged in a ring, when the countertick pointer is at the last entry in the linear order of entries, thenext clock tick triggers the TEC component 214 to shift the counter tickpointer back to the initial entry again.

In this manner, the TEC component 214 cycles the counter tick pointerthrough the entries of the timer ring responsive to the clock ticks ofthe corresponding MWC, and such that the span of time between thecurrent time and a subsequent entry in the timer ring expressed in thetime unit of the timer ring is represented by the number of entriesbetween the current entry (that is, the entry currently pointed to bythe counter tick pointer) and the subsequent entry. To illustrate, anentry 623 of the timer ring 603 that is ten entries ahead of the currententry 623 in the timer ring 603 may be said to represent a point in timeten seconds from the current time.

Each entry of a timer ring is configured to store records of any timersthat are set to expire during the clock tick period associated with theentry. These records may be stored in any of a variety of datastructures or combinations of data structures. In the depicted example,each entry 624 of the timer ring 604 comprises a linked list 606, witheach record of the linked list 606 representing the record of acorresponding timer set to expire in the clock tick period associatedwith the entry. To illustrate, in the depicted example the linked list606 includes three records 608, 609, 610 representing three timers, witheach record having, for example, an ID field 611, a parameter field 612,and a next record pointer field 613. The ID field 611 is to store atimer ID of the corresponding timer. The parameter field 612 is to storevarious parameters for the timer, such as the thread ID of the timerowner for the timer, timer priority or expiration notification priority,conditional parameters that identify under what conditions the timer is,for example, to expire or be prevented from expiring. The next recordpointer field 613 is to store a pointer to the next entry in the linkedlist. The benefit of a linked list is that its storage requirements areproportional to the number of active timers represented by recordswithin the linked list. However, in other embodiments, the timersassociated with a timer ring entry may be stored in a different type ofdata structure, such as a table or other structure with a fixed numberof entries.

FIGS. 7-10 illustrate processes for instantiating a timer and managingtimer expiration in the implementation of the timer management structure126 depicted in FIG. 6. In particular, FIG. 7 illustrates an exampleimplementation of the timer instantiation process of block 317 of method300 of FIG. 3 and FIG. 8 provides an example scenario of animplementation of this process. Similarly, FIG. 9 illustrates an exampleimplementation of the process of blocks 402, 404, and 406 of method 400of FIG. 4 and FIG. 10 provides an example scenario of an implementationof this process.

Referring now to FIG. 7, the timer instantiation process in the contextof the timer management structure 126 of FIG. 6 is initiated followingreceipt of a timer instantiation command 614 (FIG. 6) via the commandparser 208 and successful allocation of a timer ID to the requestedtimer by the TIC component 210. As noted, the timer management structure126 contains timer rings of different time unit granularities, and thusat block 702 the TPU 212 determines the time unit granularity to beimplemented for the requested timer. In one embodiment, the timerinstantiation command 614 includes an explicit indication of therequested time unit granularity.

For example, the API or other command interface provided by the timermanagement component 106 for timer commands may specify a granularityparameter to be supplied as part of the timer instantiation command 614.To illustrate, the timer instantiation command may have the formatTMR_CREATE(time_span, gr, . . . ), where “gr” represents the granularityand “time_span” represents the time span of the timer in terms of numberof clock ticks at the specified granularity. Thus, a timer commandTMR_CREATE(20, minute, . . . ) would specify that the timer is to have aminute time unit granularity and set to expire 20 minutes from thecurrent time, whereas a timer command TMR_CREATE(1200, seconds, . . . )would specify that the timer is to have a second time unit granularityand set to expire 1200 seconds from the current time. Note that bothexamples provide for a timer with the same time span duration, but atdifferent granularities.

In other embodiments, the granularity of the requested timer may beinferred from information other than the timer instantiation commanditself. To illustrate, the requestors may have been divided intodifferent classifications of requestors, and with each classificationhaving a default granularity for its instantiated timers. As anotherexample, timer management component 106 may be configured to select agranularity for a requested timer based on current conditions in theprocessor 102, such as based on the processor power state, thedistribution of timers among the different timer rings 601-604, and thelike.

With the granularity determined, at block 704 the TPU 212 determineswhich entry of the selected timer ring the timer is to be instantiatedin. As explained above, the TEC component 214 maintains a counter tickpointer that points to an entry associated with the current clock tickperiod (that is, the current entry), and each entry after the currententry in sequence order represents an additional clock tick of the MWCassociated with the timer ring. Thus, the entry to contain the requestedtimer is the entry that is X entries after the current entry in thesequence order, where X represents the number of clock ticks in theinitial time span of the timer. To illustrate, assume that the timermanagement component 106 receives a timer instantiation commandrequesting a timer set to expire in 20 minutes. Thus, the timer has agranularity of minute time units and a time span of 20 clock ticks at aone-minute clock tick period. Accordingly, if the current entry of thetimer ring 602 is entry 1, then the timer would be instantiated in entry21 (which is 20 entries “away” from entry 1).

With the particular entry of the selected timer ring identified, atblock 706 the TPU 212 instantiates the requested timer by adding a timerrecord representing the requested timer to the identified entry. Asnoted above, in some embodiments each entry may store a linked list oftimers set to expire at the clock tick period associated with the entry.Accordingly, the process of adding the timer record may includeappending an entry to the end of the linked list stored in the entry, orif the timer is the first timer to be added to the timer ring entry,creating a new linked list with the timer record added as the firstentry of the linked list.

FIG. 8 illustrates an example iteration of the process of FIG. 7. Asshown, a timer 800 having a timer ID of 18 and a time span of 7 secondsis submitted for instantiation in the seconds-based timer ring 603. Atthe time of instantiation, the counter tick pointer 801 of the timerring 603 points to entry 2 of the timer ring 603; that is, entry 2 isthe current entry at the time of instantiation. Further, in thissimplified example, the timer ring 603 has 8 entries, and thusrepresents a maximum initial timer span of 8 seconds. Given the positionof the current entry, the TPU 212 identifies entry 1 as being 7 entriesfrom the current entry in sequence order, and thus entry 1 is the entrythat will be accessed in 7 clock ticks, or 7 seconds, from the currenttime.

In the depicted example, entry 1 already has two other timer records inthe form of a first record 802 and a second record 803 of a linked list804. Thus, to instantiate the timer 800, a third record 806 is appendedto the linked list 804, with the next record pointer field 613 updatedto point to the third record 806. The third record 806 includes thetimer ID of 18 stored in the ID field 611, parameters associated withthe timer 800 in the parameter field 612, and a null value stored in thenext record pointer field 613 to indicate that the third record 806 isthe last entry of the linked list 804.

FIG. 9 illustrates the timer expiration process performed by the timermanagement component in the context of the implementation of the timermanagement structure 126 depicted in FIG. 6. The process of FIG. 9illustrates the timer expiration process of blocks 402, 404, and 406 ofmethod 400 of FIG. 4 with respect to a single timer ring of the timermanagement structure 126, and thus this process may be replicated inparallel for the multiple timer rings of the timer management structure126.

As described above, each timer ring is associated with a correspondingmaster wall clock that signals a clock tick 902 for the passage of eachtime unit associated with the granularity of the timer ring. The clocktick pointer of the timer ring is initialized to point to an initialentry, and with each clock tick 902 the clock tick pointer is shifted tothe next entry in the timer ring at block 904. In response to this shiftto the next entry, at block 906 the TEC component 214 accesses the nowcurrent entry to determine whether it contains any timer records. Ifnot, then no timers are set to expire in the timer ring for the currentclock tick period, and thus the TEC component 214 awaits the next clocktick 902.

Otherwise, if there are one or more timers in the current entry and thusset to expire in the current clock tick period, at block 908 the TECcomponent 214 selects a timer record stored in the current entry and atblock 910 the TEC component 214 triggers the issuance of a timerexpiration notification 616 (FIG. 6) for the selected timer record. Aspart of this process, the TEC component 214 may include the timer IDfrom the ID field 611 in the timer expiration notification 616, and theTEC component 214 may process the timer expiration notification 616based on one or more parameters specified in the parameter field 612 ofthe timer record, such as, for example, selectively suppressing issuanceof the timer expiration notification based on one or more conditionsspecified in the parameters of the timer record. Further, after eachtimer record is processed, the timer record may be deleted from theentry or, in the event that the timer ID is to be held as allocateduntil its release is explicitly authorized by the timer owner, the timerrecord may be marked as being held in an allocated state but no longervalid for expiry evaluation.

At block 912 the TEC component 214 determines whether any moreunprocessed timer records remain in the current entry, and if so, theprocess of blocks 908, 910, and 912 may be repeated for the next timerrecord selected from the current entry. As noted above, in someembodiments the timer records of an entry are organized as a linkedlist, and the TEC component 214 may sequence through the linked listfrom the head entry to the tail entry, with the process of blocks 908,910, and 912 repeated for each entry encountered in the linked list.

FIG. 10 illustrates an example iteration of the timer expiration processof FIG. 9 based on the example scenario described above with referenceto FIG. 8. In that scenario, the linked list 804 having first record802, second record 803, and third record 806 was created in entry 1 ofthe timer ring 603. Accordingly, as shown in FIG. 10, when the countertick pointer 801 shifts to the entry 1, the TEC component 214 accessesthe linked list 804 in the entry 1, and processes the first record 802so as to trigger issuance of a timer expiration notification 1002 thatincludes the timer ID of 6. The TEC component 214 then moves toprocessing of the second record 803 and thus triggers issuance of atimer expiration notification 1004 that includes the timer ID of 22. TheTEC component 214 then processes the third record 806 so as to triggerissuance of a timer expiration notification 1006 that includes the timerID of 18. The post-notification timer ID hold process described abovemay be implemented for each of the timer expiration notifications 1002,1004, 1006 so as to ensure that coherency is maintained for each of thetimer IDs 6, 22, and 18.

In accordance with one aspect of the present disclosure, a methodimplemented in a processing system includes selecting, at a timermanagement component of a processor, a timer ring of a set of timerrings for a requested timer based on a time unit granularity associatedwith the requested timer, wherein each timer ring of the set has adifferent time unit granularity. The method further includesinstantiating the requested timer in a selected entry of the selectedtimer ring. Instantiating the requested timer may include fixedlymaintaining a record for the requested timer in the selected entry ofthe selected timer ring for the entire time span of the requested timer.

In accordance with another aspect of the present dicslosure, a processorincludes a timer management component that includes a first interfacecoupled to a memory, a second interface configured to receive a timerinstantiation request for a requested timer, and a timer processing unitcoupled to the first and second interfaces, wherein the timer processingunit is configured to instantiate the requested timer in response to thetimer instantiation request in a selected entry of a timer ring that isselected from a set of timer rings maintained in the memory via thefirst interface based on a time unit granularity associated with therequested timer. The timer processing unit further may be configured tomaintain a record for the requested timer in the selected entry of theselected timer ring for the entire time span of the requested timer.

In accordance with yet another embodiment of the present disclosure, amethod includes maintaining, in a processing system, a set of timerrings, each timer ring associated with a different time unit granularityand having a corresponding set of entries and a corresponding clock tickpointer that is sequenced through the entries responsive to clock ticksof a corresponding clock that has a clock tick duration representativeof the time unit granularity of the timer ring. The method furtherincludes, for each shift in the clock tick pointer of each timer ring toa next entry of the timer ring, initiating transmission of a timerexpiration notification within the processing system for each timerassociated with the next entry.

Note that not all of the activities or elements described above in thegeneral description are required, that a portion of a specific activityor device may not be required, and that one or more further activitiesmay be performed, or elements included, in addition to those described.Still further, the order in which activities are listed are notnecessarily the order in which they are performed. Also, the conceptshave been described with reference to specific embodiments. However, oneof ordinary skill in the art appreciates that various modifications andchanges can be made without departing from the scope of the presentdisclosure as set forth in the claims below. Accordingly, thespecification and figures are to be regarded in an illustrative ratherthan a restrictive sense, and all such modifications are intended to beincluded within the scope of the present disclosure.

Benefits, other advantages, and solutions to problems have beendescribed above with regard to specific embodiments. However, thebenefits, advantages, solutions to problems, and any feature(s) that maycause any benefit, advantage, or solution to occur or become morepronounced are not to be construed as a critical, required, or essentialfeature of any or all the claims. Moreover, the particular embodimentsdisclosed above are illustrative only, as the disclosed subject mattermay be modified and practiced in different but equivalent mannersapparent to those skilled in the art having the benefit of the teachingsherein. No limitations are intended to the details of construction ordesign herein shown, other than as described in the claims below. It istherefore evident that the particular embodiments disclosed above may bealtered or modified and all such variations are considered within thescope of the disclosed subject matter. Accordingly, the protectionsought herein is as set forth in the claims below.

What is claimed is:
 1. In a processing system, a method comprising:selecting, at a timer management component of a processor, a timer ringof a set of timer rings for a requested timer based on a time unitgranularity associated with the requested timer, wherein each timer ringof the set has a different time unit granularity; and instantiating therequested timer in a selected entry of the selected timer ring.
 2. Themethod of claim 1, wherein instantiating the requested timer comprises:fixedly maintaining a record for the requested timer in the selectedentry of the selected timer ring for the entire time span of therequested timer.
 3. The method of claim 1, wherein selecting a timerring of the set of timer rings comprises: selecting the timer ring basedon a parameter of a timer instantiation request for the requested timer,the parameter representative of a requested time unit granularity forthe requested timer.
 4. The method of claim 3, further comprising:issuing the timer instantiation request from a requestor component ofthe processor, wherein issuing the timer instantiation request comprisesinserting the parameter into the timer instantiation request at therequestor component responsive to selecting the time unit granularityfor the requested timer from a plurality of time unit granularities. 5.The method of claim 1, wherein: the selected timer ring comprises aplurality of entries including the selected entry; a clock tick pointersequences through the plurality of entries at each clock tick of a clockhaving the time unit granularity of the selected timer ring; andinstantiating the requested timer in the selected entry of the selectedtimer ring comprises selecting the selected entry from the plurality ofentries based on a current position of the clock tick pointer and basedon an initial time span of the requested timer as represented in thetime unit granularity of the selected timer ring.
 6. The method of claim5, further comprising: in response to the clock tick pointer shifting tothe selected entry, issuing a timer expiration notification from thetimer management component to other components of the processor for eachtimer associated with the entry.
 7. The method of claim 1, whereininstantiating the requested timer comprises: inserting a timer recordrepresenting the requested timer into a data structure associated withthe selected entry.
 8. The method of claim 7, wherein: the datastructure comprises a linked list; and inserting the timer recordcomprises appending the timer record to an end of the linked list. 9.The method of claim 8, wherein: the selected timer ring comprises aplurality of entries, each entry being associated with a correspondingclock tick period of a clock having the time unit granularity of theselected timer ring; a clock tick pointer is sequenced through theplurality of entries at each clock tick of the clock; and the methodfurther includes: in response to the clock tick pointer shifting to theentry of the selected timer, traversing the linked list at the timermanagement component and issuing a timer expiration notification fromthe timer management component to other components of the processor foreach timer having a timer record in the linked list.
 10. A processorcomprising: a timer management component comprising: a first interfacecoupled to a memory; a second interface configured to receive a timerinstantiation request for a requested timer; and a timer processing unitcoupled to the first and second interfaces, wherein the timer processingunit is configured to instantiate the requested timer in response to thetimer instantiation request in a selected entry of a timer ring that isselected from a set of timer rings maintained in the memory via thefirst interface based on a time unit granularity associated with therequested timer.
 11. The processor of claim 10, wherein: the timerprocessing unit further is configured to maintain a record for therequested timer in the selected entry of the selected timer ring for theentire time span of the requested timer.
 12. The processor of claim 10,wherein: the timer processing unit further is configured to select thetimer ring from the set of timer rings based on a parameter of the timerinstantiation request, the parameter representative of a requested timeunit granularity for the requested timer.
 13. The processor of claim 10,wherein: the selected timer ring comprises a plurality of entriesincluding the selected entry; the timer management component furthercomprises a timer expiration control component configured to sequence aclock tick pointer through the plurality of entries at each clock tickof a clock having a same time unit granularity as the selected timerring; and the timer processing unit is configured to instantiate therequested timer in the selected entry of the selected timer ring byselecting the selected entry from the plurality of entries based on acurrent position of the clock tick pointer and based on an initial timespan of the requested timer as represented in the time unit granularityof the selected timer ring.
 14. The processor of claim 13, wherein: inresponse to the clock tick pointer shifting to the selected entry, thetimer expiration control component further is configured to issue atimer expiration notification from the timer management component toother components of the processor for each timer associated with theentry.
 15. The processor of claim 10, wherein: the timer processing unitis configured to instantiate the requested timer by inserting a timerrecord representing the requested timer into a data structure associatedwith the selected entry.
 16. The processor of claim 15, wherein: thedata structure comprises a linked list; and the timer processing unit isconfigured to insert the timer record by appending the timer record toan end of the linked list.
 17. A method comprising: maintaining, in aprocessing system, a set of timer rings, each timer ring associated witha different time unit granularity and having a corresponding set ofentries and a corresponding clock tick pointer that is sequenced throughthe entries responsive to clock ticks of a corresponding clock that hasa clock tick duration representative of the time unit granularity of thetimer ring; and for each shift in the clock tick pointer of each timerring to a next entry of the timer ring, initiating transmission of atimer expiration notification within the processing system for eachtimer associated with the next entry.
 18. The method of claim 17,further comprising: for each of a plurality of timer instantiationrequests issued by a component of the processing system: determining atime unit granularity based on the timer instantiation request; andinstantiating a timer in a selected entry of a timer ring of the set oftimer rings that is selected based on the determined time unitgranularity.
 19. The method of claim 18, wherein instantiating the timercomprises: inserting a timer record representing the requested timerinto a data structure associated with the selected entry.
 20. The methodof claim 18, wherein: determining the time unit granularity comprisesdetermining the time unit granularity based on a parameter included inthe timer instantiation request.